<?php
/**
 * Smart Library - Smart Framework
 * http://smart-framework.highet.eu
 *
 * @category   SmartL
 * @package    SmartL_Zend
 * @subpackage Controller
 * @copyright  Copyright (c) 2005-2008 Smart Framework team - Stepan Sindelar, Vojtech Vit
 * @license    http://www.opensource.org/licenses/bsd-license.php	New BSD License
 */

/**
 * Class that holds informations about translation.
 * It holds these informations: file, adapter, extension, id.
 * 
 * @package SmartL_Zend
 * @subpackage Controller
 */
class SmartL_Zend_Controller_Action_Config_ActionInfo_TranslationInfo {
	
	private $_file = null;
	private $_adapter = null;
	private $_extension = null;
	private $_id = null;
	
	/**
	 * @param string $value
	 */
	public function setFile($value) {
		$this->_file = $value;
	}
	/**
	 * Path to file with translation.
	 *
	 * @return string
	 */
	public function getFile() {
		return $this->_file;
	}
	
	/**
	 * @param string $value
	 */
	public function setAdapter($value) {
		$this->_adapter = $value;
	}
	/**
	 * Name of adapter of translation.
	 *
	 * @return string
	 */
	public function getAdapter() {
		return $this->_adapter;
	}
	
	/**
	 * @param string $value
	 */
	public function setExtension($value) {
		$this->_extension = $value;
	}
	/**
	 * Extension of adapter files of this translation.
	 * If extension is not set, it tries to find default extension for given adapter.
	 * Supported are addapters: txm, gettext and array.
	 *
	 * @return string
	 */
	public function getExtension() {
		if (isset ( $this->_extension )) {
			return $this->_extension;
		} else {
			switch (strtolower ( $this->_adapter )) {
				case 'array' :
					return 'php';
				case 'gettext' :
					return 'mo';
				case 'tmx' :
					return 'tmx';
				default :
					require_once 'SmartL/Zend/Controller/Action/Exception.php';
					throw new SmartL_Zend_Controller_Action_Exception ( "Not supported translate adapter ({$adapterName}) in action config given" );
			}
		}
	}
	
	/**	 
	 * @param string $value
	 */
	public function setId($value) {
		$this->_id = $value;
	}
	/**
	 * Id is used for identification of translations.
	 *
	 * @return string
	 */
	public function getId() {
		return $this->_id;
	}
}


